package com.pi.stroop.enumerate;

public enum DiagnosisLevelEnum {
  GOOD(1,"优秀"),
  WELL(2,"良"),
  NORMAL(3,"继续努力"),
  OPPS(4,"快找医生"),
  UNKNOWN(0,"未知"),
  ;
  private int level;
  private String desc;
  DiagnosisLevelEnum(int level, String desc) {
    this.level = level;
    this.desc = desc;
  }
  public int getLevel() {
    return level;
  }
  public String getDesc() {
    return desc;
  }
  public static String getDiagnosisLevelDesc(Integer level){
    if(null == level){
      return UNKNOWN.desc;
    }
    for(DiagnosisLevelEnum levelEnum:values()){
      if(levelEnum.getLevel() == level.intValue())
        return levelEnum.getDesc();
    }
    return UNKNOWN.desc;
  }
  
  public static int setDiagnosisLevel(Integer score){
    if(null == score){
      return UNKNOWN.getLevel();
    }
    if(score > 95){
      return GOOD.getLevel();
    }else if(score >88){
      return WELL.getLevel();
    }else if(score >=80){
      return NORMAL.getLevel();
    }else{
      return OPPS.getLevel();
    }
  }
}
